<script type="text/javascript" src="/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript" charset="utf-8" src="/ueditor/kityformula-plugin/addKityFormulaDialog.js"></script>
<script type="text/javascript" charset="utf-8" src="/ueditor/kityformula-plugin/getKfContent.js"></script>
<script type="text/javascript" charset="utf-8" src="/ueditor/kityformula-plugin/defaultFilterFix.js"></script>
<script type="text/javascript" src="/My97DatePicker/WdatePicker.js"></script>
<style>
    #login-button{
        margin-top: 20px;
        background: #286090!important;
        color: white!important;
        border: 1px solid #286090!important;
        border-radius: 3px;
    }
</style>
<div class="span10">
    <div style="margin-bottom: 20px;">
        <a>首页</a>
        <span >&gt;</span>
        <span>文案管理</span>
        <span >&gt;</span>
        <span>添加</span>
    </div>
    <form class="form" method="post" action="<?php echo baseUrl."/content/evaluation/add"?>" enctype="multipart/form-data">
        <table>
            <div class="control-group">
                <label for="moduledescribe" class="control-label">家长评价图片</label>

                <div class="controls">
                    <div style="margin-bottom: -10px">
                        <span>
                            <input type="text" class="imageFile" name="parent_evaluation"
                             value="<?php echo isset($data['parent_evaluation']) ? $data['parent_evaluation'] : '' ?>"
                             placeholder="图片地址">
                        </span>
                        <br>
                        <br>
                    </div>
                    <a href="#" class="btn btn-info" onclick="upImage();">上传家长评价图</a>
                </div>
            </div>

            <div class="control-group" style="margin-top: 30px">
                <label for="moduledescribe" class="control-label">学生评价图片</label>

                <div class="controls">
                    <div style="margin-bottom: -10px">
                        <span>
                            <input type="text" class="imageFile2" name="student_evaluation"
                             value="<?php echo isset($data['student_evaluation']) ? $data['student_evaluation'] : '' ?>"
                             placeholder="图片地址">
                        </span>
                        <br>
                        <br>
                    </div>
                    <a href="#" class="btn btn-info" onclick="upImage2();">上传学生评价图</a>
                </div>
            </div>
            <tr>
                <td>浏览量:</td>
                <td>
                    <input type="text" name="viewCount" value="<?php echo isset($data)?$data['viewCount']:''?>" placeholder="浏览量" >
                </td>
            </tr>
            <tr>
                <td>排序:</td>
                <td>
                    <input type="text" name="sort" value="<?php echo isset($data)?$data['sort']:''?>" placeholder="排序" >
                </td>
            </tr>
            <tr>
                <td colspan="2" align="right">
                    <input type="hidden" name="id" value="<?php echo isset($data)?$data['id']:''?>"/>
                    <button type="submit" id="login-button">添加/修改</button>
                </td>
            </tr>
            <input type="hidden" name="_csrf" value="<?=Yii::$app->request->getCsrfToken()?>" />
        </table>
    </form>

    <script type="text/javascript">
        //实例化编辑器
        var o_ueditorupload = UE.getEditor('j_ueditorupload',
            {
                autoHeightEnabled:false
            });
        o_ueditorupload.ready(function ()
        {

            o_ueditorupload.hide();//隐藏编辑器

            //监听图片上传
            o_ueditorupload.addListener('beforeInsertImage', function (t,arg)
            {
                $('.imageFile').val(arg[0].src);

            });

            /* 文件上传监听
             * 需要在ueditor.all.min.js文件中找到
             * d.execCommand("insertHtml",l)
             * 之后插入d.fireEvent('afterUpfile',b)
             */
            o_ueditorupload.addListener('afterUpfile', function (t, arg)
            {

            });
        });

        //弹出图片上传的对话框
        function upImage()
        {
            var myImage = o_ueditorupload.getDialog("insertimage");
            myImage.open();
        }

        //实例化编辑器
        var o_ueditorupload2 = UE.getEditor('j_ueditorupload2',
            {
                autoHeightEnabled:false
            });
        o_ueditorupload2.ready(function ()
        {

            o_ueditorupload2.hide();//隐藏编辑器

            //监听图片上传
            o_ueditorupload2.addListener('beforeInsertImage', function (t,arg)
            {
                $('.imageFile2').val(arg[0].src);

            });

            /* 文件上传监听
             * 需要在ueditor.all.min.js文件中找到
             * d.execCommand("insertHtml",l)
             * 之后插入d.fireEvent('afterUpfile',b)
             */
            o_ueditorupload2.addListener('afterUpfile', function (t, arg)
            {

            });
        });
        //弹出图片上传的对话框
        function upImage2()
        {
            var myImage2 = o_ueditorupload2.getDialog("insertimage");
            myImage2.open();
        }
    </script>
    <script type="text/plain" id="j_ueditorupload"></script>
    <script type="text/plain" id="j_ueditorupload2"></script>
</div>